var brOK=false;
//var mie=false;
//var vmin=20;
//var vmax=5;
//var vr=3;
var adtimer;
var jobads;
var jobads2;

function movead()
{
		if(brOK)
		{
			var ad;
			if(jobads != null){
				ad = jobads;
				var curLeft = parseInt(ad.style.left);
				var curTop = parseInt(ad.style.top);
				if((ad.offsetWidth + curLeft) > (document.body.clientWidth + document.body.scrollLeft - 1))
				{
					curLeft = document.body.scrollLeft + document.body.clientWidth - ad.offsetWidth;
					ad.DirH = false;
				}
				if((ad.offsetHeight + curTop) > (document.body.clientHeight + document.body.scrollTop - 1))
				{
					curTop = document.body.scrollTop + document.body.clientHeight - ad.offsetHeight;
					ad.DirV = false;
				}
				if(curLeft < document.body.scrollLeft)
				{
					curLeft = document.body.scrollLeft;
					ad.DirH = true;
				}
				if(curTop < document.body.scrollTop)
				{
					curTop = document.body.scrollTop;
					ad.DirV = true;
				}
				ad.style.left = curLeft + (ad.DirH ? 2 : -2) + "px";
				ad.style.top = curTop + (ad.DirV ? 2 : -2) + "px";
			}

			if(jobads2 != null){
				ad = jobads2;
				var curRight = parseInt(ad.style.right);
				var curTop = parseInt(ad.style.top);
				if((ad.offsetWidth + curRight) > (document.body.clientWidth + document.body.scrollRight - 1))
				{
					curRight = document.body.scrollRight + document.body.clientWidth - ad.offsetWidth;
					ad.DirH = false;
				}
				if((ad.offsetHeight + curTop) > (document.body.clientHeight + document.body.scrollTop - 1))
				{
					curTop = document.body.scrollTop + document.body.clientHeight - ad.offsetHeight;
					ad.DirV = false;
				}
				if(ad.offsetHeight + curRight > document.body.clientWidth)
				{
					ad.DirH = true;
				}
				if(curRight < 0)
				{
					curRight = 0;
					ad.DirH = false;
				}
				if(curTop < document.body.scrollTop)
				{
					curTop = document.body.scrollTop;
					ad.DirV = true;
				}
				
				ad.style.right = curRight + (ad.DirH ? -2 : 2) + "px";
				ad.style.top = curTop + (ad.DirV ? 2 : -2) + "px";
			}
			
			if(jobads != null || jobads2 != null){
				adtimer = window.setTimeout("movead();",200);				
			}
	  }
}


function stopme()
{
	if(brOK)
	{
		if(adtimer != null)
		{
			window.clearTimeout(adtimer);
            adtimer = null;
		}
	}
}

function jobads()
{
	if(navigator.appName.indexOf("Internet Explorer")!=-1)
	{
		if(parseInt(navigator.appVersion.substring(0,1))>=4) brOK=navigator.javaEnabled();//mie=true;
	}
	if(navigator.appName.indexOf("Netscape")!=-1)
	{
		if(parseInt(navigator.appVersion.substring(0,1))>=4) brOK=navigator.javaEnabled();
	}
    jobads = document.getElementById("jobads");
    jobads.style.display = "block";
	
	jobads2 = document.getElementById("jobads2");
    jobads2.style.display = "block";
	
	movead();
}
function closead1()
{
	if(jobads == null && jobads2 == null){
		 stopme();
	}
	document.body.removeChild(jobads);
	jobads = null;
	movead();
}
function closead2()
{
    if(jobads == null && jobads2 == null){
		 stopme();
	}
	document.body.removeChild(jobads2);
	jobads2 = null;	
	movead();
}

